<template>
	<view>
		<view :style="[{height:CustomBar + 'px'}]">
			<view class="header fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor,hasShadow?'cu-bar':'']">
				<view class="left text-lg">
					<slot name="left"></slot>
				</view>
				<view class="center" :style="[{top:StatusBar + 'px'}]">
					<slot name="content"></slot>
				</view>
				<view class="right">
					<slot name="right"></slot>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				StatusBar: this.StatusBar,
				CustomBar: this.CustomBar
			};
		},
		name: 'cu-custom',
		computed: {
			style() {
				var StatusBar= this.StatusBar;
				var CustomBar= this.CustomBar;
				var bgImage = this.bgImage;
				var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
				if (this.bgImage) {
					style = `${style}background-image:url(${bgImage});`;
				}
				return style
			}
		},
		props: {
			bgColor: {
				type: String,
				default: ''
			},
			bgImage: {
				type: String,
				default: ''
			},
			hasShadow:{
				type:Boolean,
				default:true
			}
		},
		methods: {
		}
	}
</script>

<style scoped>
.header{
	display: flex;
	flex-direction: row;
	align-items: center;
	padding-left: 10px;
	padding-right: 10px;
}
.left{
	margin-right: 4px;
}
.center{
	flex: 1;
	height: 100%;
	padding-top: 10upx;
	padding-bottom:10upx ;
}
.right{
	margin-left: 4px;
}
</style>
